#!/bin/bash
# get exclusive urlshort project size

URLSHORT_DIR="."
URLSHORT_TMP="$URLSHORT_DIR/urlshort.tmp"

du -sSb $URLSHORT_DIR | \
cut -f1 > $URLSHORT_TMP
du -sSb $URLSHORT_DIR/classes | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/clipboard/src | \
cut -f1 >> $URLSHORT_TMP
du -sSb $URLSHORT_DIR/includes | \
cut -f1 >> $URLSHORT_TMP
du -sSb $URLSHORT_DIR/public_html | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/public_html/admin | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/public_html/css | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/public_html/images | \
cut -f1 >> $URLSHORT_TMP
du -sSb $URLSHORT_DIR/public_html/js | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/public_html/swf | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/smarty/config | \
cut -f1 >> $URLSHORT_TMP
du -sb $URLSHORT_DIR/smarty/templates | \
cut -f1 >> $URLSHORT_TMP

URLSHORT_DU=$(cat $URLSHORT_TMP | \
awk '{ SUM += $1 } END { print SUM/1024/1024 }')
unlink $URLSHORT_TMP
printf "%.3fM\n" $URLSHORT_DU
